import pytest
from selenium import webdriver


@pytest.fixture(scope="session")
def driver(request):
    driver = webdriver.Chrome()
    print("\ndriver已生成")

    def end():
        driver.quit()

    request.addfinalizer(end)
    return driver


@pytest.fixture(scope="class")
def start(driver):
    print("\n打开主页")
    driver.get(url="https://baidu.com")
